package nc.tb.app.plantable.ui;

import nc.tb.app.ui.PlanBuildPanel;
import nc.tb.cube.CubeView;
import nc.tb.cube.model.Plan;
import nc.tb.pub.util.NtbLogger;
import nc.tb.ufo.ui.UFOTablePane;

public class PlanBuildTablePanel extends PlanBuildPanel {
	
	private NtbTablePane ntbTablePane = null;
	private Plan m_plan = null;
	private CubeView m_cubeView = null;
	
	
	public PlanBuildTablePanel(Plan plan, CubeView cbView) {
		super();
		m_plan = plan;
		m_cubeView = cbView;
		try {
			remove(getufoTable());
		} catch (RuntimeException e) {
			NtbLogger.printException(e);
		}
		add(getNtbTablePane(), "Center");
	}
	
	public UFOTablePane getufoTable() {
		if (ntbTablePane == null)
			return super.getufoTable();
		else
			return getNtbTablePane();
	}

	public NtbTablePane getNtbTablePane() {
		if (ntbTablePane == null) {
			try {
				ntbTablePane = new NtbTablePane(m_plan, m_cubeView);
				ntbTablePane.setName("ufoTable");
				// user code begin {1}
				//ivjufoTable.setTable(UFOTable.createFiniteTable(10,10));
//				ivjufoTable.getInputPanel().removeBtnRef();
				// user code end
			} catch (java.lang.Throwable ivjExc) {
				// user code begin {2}
				// user code end
				NtbLogger.printException(ivjExc);
			}
		}
		return ntbTablePane;
	}
}
